home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13712 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.2 KB  |  53 lines

  1. Newsgroups: comp.lang.c
  2. Path: news1.io.org!torfree!bz786
  3. From: bz786@torfree.net (Sherif Asif)
  4. Subject: Help to detect error 
  5. Message-ID: <DpMA82.KEE.0.bloor@torfree.net>
  6. Organization: Toronto Free-Net
  7. X-Newsreader: TIN [version 1.2 PL2]
  8. Date: Tue, 9 Apr 1996 22:52:49 GMT
  9.  
  10. I am using unix compiler and I get the following error message
  11. II am learing on my own please help me. Last time when I posted I got 
  12. lots of reply . Thanks .
  13. line 6: syntax error at or near type word "int"
  14. line 20: syntax error at or near type word "int"
  15. line 23: n undefined
  16. line 25: syntax error at or near word "if"
  17. line 26: x undefined
  18.  
  19. #include <stdio.h>
  20. /*reoder 1 dim array, int array from smallest to largest*/
  21. main()
  22. {
  23. int i, n, x[100];
  24. reorder (int n , int x[]); /* LINE 6 */
  25. printf ("How many no:\n");
  26. scanf ("%d",&n);
  27. printf("\n");
  28. for (i=0; i<n;++i);
  29. {
  30. printf ("i = %d  x = ",i+1);
  31. scanf ("%d", &x[n]);
  32. }
  33. reorder (n,x);
  34. printf ("Recorded list of nos:\n\n");
  35. for (i=0; i<n; ++i)
  36. printf ("i= %d  x=%d\n", i+1, x[i]);
  37. }
  38. reorder (int n, int x[]) /* LINE 20 */
  39. {
  40. int item,i,temp;
  41. for (item=0; item < n-1; ++item) /* LINE 23 */
  42.  
  43. for (i=item+1; i<n;++i/
  44. if (x[i]<x[item])  {   /* LINE 25 */
  45. temp=x[item];
  46. x[item]=x[i];
  47. x[i]=temp;
  48.                 }
  49. return;
  50. }
  51.  
  52. -- 
  53.